const _ = require("lodash");

const arr = ['a', 'b', 'a', 'b', 'a', 'c'];
const result = _.countBy(arr);
console.log(result);
// => { a: 3, b: 2, c: 1 }
